package com.szl.group.controller.api;


import com.szl.group.common.model.ApiCommonModel;
import com.szl.group.common.model.R;
import com.szl.group.service.impl.ApiServiceDispathcer;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * description:
 * author: shenxiaolong
 * date: 2020/7/31  22:43
 */

@RestController
@RequestMapping("/router/api")
public class ApiDispatcherController {


    @Resource
    private ApiServiceDispathcer apiServiceDispathcer;

    /**
     * API 路由器
     *
     * @param
     * @return
     */
    @PostMapping("/v1/service")
    public R dispatcher(ApiCommonModel params,
                        @RequestBody(required = false) String requestBody,
                        HttpServletRequest request) {

        return apiServiceDispathcer.handler(params, requestBody, request);

    }


}
